import requests

from api.ihrm_emp_get_token import IhrmLongintoken


class IhrmAppEmp(object):
    @classmethod
    def add_emp(cls,token,json_data):
        resp=requests.post(url="http://ihrm-test.itheima.net/api/sys/user",
                       headers={"Authorization":token},json=json_data)
        return resp
    @classmethod
    def put_emp(cls,token,json_data,id):
        resp=requests.put(url="http://ihrm-test.itheima.net/api/sys/user/"+id,
                          headers={"Authorization":token},json=json_data)
        return resp
    @classmethod
    def delete_emp(self,token,id):
        resp=requests.delete(url="http://ihrm-test.itheima.net/api/sys/user/"+id,
                             headers={"Authorization":token})
        return resp

    @classmethod
    def get_emp(self, token,id):
        resp = requests.get(url="http://ihrm-test.itheima.net/api/sys/user/"+id,
                               headers={"Authorization": token})
        return resp





if __name__ == '__main__':
    token = IhrmLongintoken.Ihrmtoken()
    id='1525063330882977792'
    # data={"username":"小李刀","password":"654321"}
    # r=IhrmAppEmp.put_emp(token,data)
    r=IhrmAppEmp.get_emp(token,id)
    print(r.json())

